using IcsSEMCtrl.Global.Device;
using IcsSEMCtrl.Service.Logger;
using System;
using System.Collections.Generic;
namespace IcsSEMCtrl.Device
{
	public abstract class AbstractSubSystem : AbstractElement
	{
		private const string CLASS = "AbstractSubSystem";
		public Dictionary<string, SubSystem> subsystems = new Dictionary<string, SubSystem>();
		public Dictionary<string, IODevice> ioDevices = new Dictionary<string, IODevice>();
		public AbstractSubSystem()
		{
		}
		public void AddSubSystem(string subSystemId, SubSystemType subSystemType, string assemblyName, string className)
		{
			SubSystem value = SubSystem.CreateSubSystem(this.elementId, this.elementType, subSystemId, subSystemType, assemblyName, className);
			this.subsystems.Add(subSystemId, value);
		}
		public void RemoveSubSystem(string subSystemId)
		{
			if (this.subsystems.ContainsKey(subSystemId))
			{
				SubSystem subSystem = this.subsystems[subSystemId];
				subSystem.Delete();
				this.subsystems.Remove(subSystemId);
			}
		}
		public SubSystem GetSubSystem(string subSystemId)
		{
			SubSystem result = null;
			if (this.subsystems.ContainsKey(subSystemId))
			{
				result = this.subsystems[subSystemId];
			}
			return result;
		}
		public void RemoveIODevice(string ioDeviceId)
		{
			if (this.ioDevices.ContainsKey(ioDeviceId))
			{
				IODevice iODevice = this.ioDevices[ioDeviceId];
				iODevice.Delete();
				this.ioDevices.Remove(ioDeviceId);
			}
		}

		public abstract void Init();
		public abstract void Startup();
		public abstract void Shutdown();
		public abstract void Exit();
	}
}
